@using System.Reflection;

@helper PageLink(string Name,string URL, dynamic QueryString){
    @* Generate a Html link in the webpage 
       exemple : @MyHelper.PageLink("google","http://google.fr",new{search = "Microsoft", lang="en-EN"})
       will generate the following link :
       <a href="http://google.fr?search=Microsoft&lang=en-EN">google</a>
    *@
    @{
        string Query="";
        if(QueryString!=null){
            Query+="?";
            PropertyInfo[] Properties = QueryString.GetType().GetProperties();
            foreach(var Property in Properties)
            {
                
                Query+=Property.Name;
                Query+="=";
                Query+=System.Web.HttpUtility.UrlEncode(Property.GetValue(QueryString,null).ToString());
                Query+="&";
            }
        }
        Query=URL+Query;
    }
        
	
    <a href="@Query">@Name</a>
}